from typing import List
class Solution:
    def numberOfBeams(self, bank: List[str]) -> int:
        """
        :type bank: List[str]
        :rtype: int
        """
        isnull = []
        n = len(bank)
        for i in range(n):
            if bank[i].count('1') == 0:
                isnull.append(i)
        current = 0
        ans = 0
        while current<n-1:
            cnt1 = bank[current].count('1')
            cursor = current+1
            while cursor<n:
                if cursor in isnull:
                    cursor+=1
                    continue
                cnt2 = bank[cursor].count('1')
                ans+= cnt1*cnt2   
                break
            current = cursor
        return ans